<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Awesome Banking System</title>
</head>
<script type="text/javascript">
	function deleteAcct()
	{
		if(document.getElementsByName("toDelete")[0].value == "")
			alert("Please specify an account to delete");
		else if(document.getElementsByName("transferToAccnt")[0].value == "")
			alert("Please specify an account to deposit remaining funds.");
		else
		{
			//delete account
		    var form = document.createElement("form");
		    form.setAttribute("method", "post");
		    form.setAttribute("action", "http://localhost:4080/Proj3/BankingServlet");

		    var params = new Object();
		    params["from"] = document.getElementsByName("toDelete")[0].value;
		    params["to"] = document.getElementsByName("transferToAccnt")[0].value;
		    params["delete"] = document.getElementsByName("toDelete")[0].value;
		    params["Del"] = true;
		    
		    for(var key in params)
		    {
		        var hiddenField = document.createElement("input");
		        hiddenField.setAttribute("type", "hidden");
		        hiddenField.setAttribute("name", key);
		        hiddenField.setAttribute("value", params[key]);

		        form.appendChild(hiddenField);
		    }

		    document.body.appendChild(form);
		    form.submit();
		}
	}
	
	function getAccounts()
	{
		
	}

</script>
<body>
<!-- <form method="POST" action=BankingServlet >-->
<h1>Delete Account Page</h1>
<input type="hidden" name="Del" value="Del" />

Account Name:<input type="text" name="toDelete" /><br>
Place any remaining funds in:<input type="text" name="transferToAccnt" /><br>

<input type="button" value="Delete Account" onclick="deleteAcct()"/><br><br>
<!-- </form>-->
<form action=MainPage><input type="submit" value="Back to Main Page"></form>

</body>
</html>